#!/bin/sh

set -e

if [ -f /lib/systemd/system/connman.service ] ; then
        #Seeed WifiConfig
        if [ -f /etc/connman/service.set.nodnsproxy ] ; then
                unset check_connman
                check_connman=$(cat /lib/systemd/system/connman.service | grep ExecStart | grep nodnsproxy || true)
                if [ "x${check_connman}" = "x" ] ; then
                        sed -i -e 's:connmand -n:connmand -n --nodnsproxy:g' /lib/systemd/system/connman.service || true
                        rm -rf /etc/connman/service.set.nodnsproxy || true
                fi
        fi

        #NFS eth0
        if [ -f /etc/connman/service.set.eth0 ] ; then
                unset check_connman
                check_connman=$(cat /lib/systemd/system/connman.service | grep ExecStart | grep eth0 || true)
                if [ "x${check_connman}" = "x" ] ; then
                        sed -i -e 's:connmand -n:connmand -n -I eth0:g' /lib/systemd/system/connman.service || true
                        rm -rf /etc/connman/service.set.eth0 || true
                fi
        fi
fi

case "$1" in
        configure)
                if [ -x /usr/share/update-notifier/notify-reboot-required ]; then
                        /usr/share/update-notifier/notify-reboot-required
                fi
        ;;
esac

#DEBHELPER#
